//
//  Header.h
//  StationManager
//
//  Created by Helong on 17/3/3.
//  Copyright © 2017年 Helong. All rights reserved.
//

#ifndef Header_h
#define Header_h

#define IMAGE_HEIGHT 220
#define NAVBAR_COLORCHANGE_POINT (IMAGE_HEIGHT - NAVIGATION_BAR_HEIGHT*2)


//判断是否是ipad
#define isPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
//判断iPhone4系列
#define kiPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhone5系列
#define kiPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhone6系列
#define kiPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iphone6+系列
#define kiPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneX
#define IS_IPHONE_X ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPHoneXr
#define IS_IPHONE_Xr ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs
#define IS_IPHONE_Xs ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs Max
#define IS_IPHONE_Xs_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)

#define IS_IPhoneX_All (AUTO_SCREEN_HEIGHT == 812 || AUTO_SCREEN_HEIGHT == 896)

// 状态栏高度
#define STATUS_BAR_HEIGHT [[UIApplication sharedApplication] statusBarFrame].size.height

// 导航栏高度
#define NAVIGATION_BAR_HEIGHT (IS_IPhoneX_All? 88.f : 64.f)
// tabBar高度
#define TAB_BAR_HEIGHT (IS_IPhoneX_All ? (49.f+34.f) : 49.f)
// home indicator
#define HOME_INDICATOR_HEIGHT (IS_IPhoneX_All ? 34.f : 0.f)

///导航栏高度 （不加导航栏）
#define Navagation_Bar_height (IS_IPhoneX_All ? 44 : 44)

/// 底部宏，
#define SafeAreaBottomHeight (IS_IPhoneX_All ? 34 : 0)


//获取屏幕的宽度、高度
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

//不管横竖屏都获取较短的那个长度
#define AUTO_SCREEN_WIDTH (([UIScreen mainScreen].bounds.size.width > [UIScreen mainScreen].bounds.size.height)?[UIScreen mainScreen].bounds.size.height:[UIScreen mainScreen].bounds.size.width)
///比较长的长度
#define AUTO_SCREEN_HEIGHT (([UIScreen mainScreen].bounds.size.width < [UIScreen mainScreen].bounds.size.height)?[UIScreen mainScreen].bounds.size.height:[UIScreen mainScreen].bounds.size.width)
//适配比例，以iphone6尺寸为基准
// #define wl ([UIScreen mainScreen].bounds.size.width/375)
// #define hl ([UIScreen mainScreen].bounds.size.height/667)
#define wl (AUTO_SCREEN_WIDTH/375)
///如果是iPhoneX高度比例为1 （与4.7寸的高一样）
//#define hl (IS_IPhoneX_All ? 667.0/667.0 : AUTO_SCREEN_HEIGHT/667.0)
#define hl (AUTO_SCREEN_HEIGHT == 812 ? 667.0/667.0 : (AUTO_SCREEN_HEIGHT == 896 ? 736.0/667.0 : AUTO_SCREEN_HEIGHT/667.0))
#define xhl (AUTO_SCREEN_HEIGHT/667.0)

/// 第一个参数是当下的控制器适配iOS11 一下的，第二个参数表示scrollview或子类
#define AdjustsScrollViewInsetNever(controller,view) if(@available(iOS 11.0, *)) {view.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;} else if([controller isKindOfClass:[UIViewController class]]) {controller.automaticallyAdjustsScrollViewInsets = false;}




//DEBUG模式下打印日志
#ifdef DEBUG
#define HLog(fmt, ...) HLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define HLog(...)
#endif

//整体背景色
#define BACKGROUND_COLOR [UIColor colorWithRed:242.0/255.0 green:242.0/255.0 blue:242.0/255.0 alpha:1.0f]
#define GRAY_COLOR [UIColor colorWithRed:166.0/255.0 green:166.0/255.0 blue:166.0/255.0 alpha:1.0f]
#define MAIN_COLOR UIColorFromRGBA(0x00bb9c, 1.f)

//获取系统版本
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

//判断设备操作系统是否为iOS7
#define  IOS7 ([[UIDevice currentDevice].systemVersion doubleValue] >=7.0)

//RGB颜色转换 （16进制->10进制）
#define UIColorFromRGBA(rgbValue, alphaValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 blue:((float)(rgbValue & 0x0000FF))/255.0 alpha:alphaValue]

//RGB颜色
#define RGBACOLOR(R,G,B,A) [UIColor colorWithRed:(R)/255.0 green:(G)/255.0 blue:(B)/255.0 alpha:(A)]
#define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0f]



//清除背景色
#define CLEARCOLOR [UIColor clearColor]
#define WHITECOLOR [UIColor whiteColor]
//整体字体颜色,大小
#define TEXT_COLOR [UIColor colorWithRed:(51)/255.0 green:(71)/255.0 blue:(113)/255.0 alpha:1.0]
#define TEXT_FONT  [UIFont systemFontOfSize:14*wl]
#define TEXT_FONT15 [UIFont systemFontOfSize:15*wl]
#define TEXT_FONT16 [UIFont systemFontOfSize:16*wl]
#define TEXT_FONT11  [UIFont systemFontOfSize:11*wl]
#define TEXT_FONT12  [UIFont systemFontOfSize:12*wl]
#define TEXT_FONT13 [UIFont systemFontOfSize:13*wl]
#define ViewHeight 44*hl

//方正黑体简体字体定义
#define FONT(F) [UIFont fontWithName:@"FZHTJW--GB1-0" size:F]

//定义一个API
#define APIURL @"http://"

//GCD
#define BACK(block) dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block)
#define MAIN(block) dispatch_async(dispatch_get_main_queue(),block)

//NSUserDefaults 实例化
#define USER_DEFAULT [NSUserDefaults standardUserDefaults]

//由角度获取弧度 有弧度获取角度
#define angleToRadian(x) (M_PI*(x)/180.0)
#define radianToAngle(r) (r*180.0)/M_PI

//block块呢,self->weakSelf
#define WeakSelf __weak typeof(self) weakSelf = self;

//第三方服务的key


#endif /* Header_h */
